package 软件测试.实验2;/**
 * ************************************************************************
 * 项目名称: projectweb <br>
 * 文件名称:  <br>
 * 文件描述: 这里添加您的类文件描述，说明当前文件要包含的功能。 <br>
 * 文件创建：1913040634刘世锦  <br>
 * 创建时间: 2021/4/16 <br>
 *
 * @version v1.0 <br>
 * @update [序号][日期YYYY-MM-DD][更改人姓名][变更描述]<br>
 * ************************************************************************
 */




/**
 * @ProjectName: projectweb
 * @ClassName: T1
 * @Description: 请描述该类的功能
 * @Author: 1913040634刘世锦
 * @Date: 2021/4/16 10:37 .
 * @version v1.0
 */

import java.util.Scanner;
public class T1 {


    public static void main(String[] args) {
        int  a = 1;
       Scanner sc = new Scanner(System.in);
        System.out.println("请输入a的值");
        System.out.println("若a=1，继续执行，若a=0结束");
      a = sc.nextInt();
         while(a>=1){
             int year=0,month=0,day=0;
             NextDate(year,month,day);
             System.out.println("请输入a的值");
             System.out.println("若a>=1，继续执行，若a=0结束");
             a=sc.nextInt();
         }
            if (a==0){
                System.out.println("结束");
            }
    }


  public static   void NextDate(int year,int month,int day)
    {  System.out.println("请输入年份：");
        Scanner sc =  new Scanner(System.in);
        year = sc.nextInt();


        while(!(year>=1811 && year<=2013))
        {
            System.out.printf("年份超过界限，请重新输入");

            year = sc.nextInt();
        }

        System.out.printf("请输入月份：");
         month = sc.nextInt();
        while (month>12||month<1)
        {
            System.out.printf("月份超过界限，请重新输入");
            month = sc.nextInt();
        }

        System.out.printf("请输入日期：");
       day = sc.nextInt();
        while (day>31||day<1)
        {
            System.out.printf("日期输入有误，请重新输入");
            day = sc.nextInt();
        }

        if((year%4==0 && year%100!=0) || (year%400==0))  /*检查闰年*/
        {
            int i=0;
            i=day-29;
            while(month==2&&i>0)
            {
                 System.out.printf  ("本月是闰月，请在1-29之间从新输入日期\n");
                day = sc.nextInt();
            }
            if(month==2&&day==29)
            {
                month=3;
                day=1;

            }
            else day++;
        }
        else day++;
        /*月底计算*/
        switch(month)
        {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
                if (day==32)
                {
                    month++;
                    day=1;
                     System.out.printf("明天是：%d/%d/%d\n",year,month,day);
                }
                break;
            case 2:
                if(day==29)
                {
                    month=3;
                    day=1;
                     System.out.printf("明天是：%d/%d/%d\n",year,month,day);
                }
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                if(day==31)
                {
                    month++;
                    day=1;
                     System.out.printf("明天是：%d/%d/%d\n",year,month,day);
                }
                break;
            case 12:
                if(day==32)
                {
                    year++;
                    month=1;
                    day=1;
                     System.out.printf("明天是：%d/%d/%d\n",year,month,day);
                }
                break;
        }
         System.out.printf("明天是：%d/%d/%d\n",year,month,day);
    }
}
